import React, {Component} from 'react';
import {

} from 'react-native';

import Config from '../../config';
import DataManager from '../../datas/DataManager';
import SizeUtils from '../../common/SizeUtils';
import Constants from '../../common/Constants';
import IMOne2OneCommentPage from '../im/IMOne2OneCommentPage';
import UserManagerChatLinker from '../../datas/im/UserManagerChatLinker';
import IMConstants from '../im/IMConstants';
import UserManagerChatItemView from './UserManagerChatItemView';

//管理员私聊--聊天界面
export default class UserManagerChatPage extends IMOne2OneCommentPage {
  constructor(props) {
    super(props);
  }

  _initLinker() {
    this._linker = DataManager.callMethod(Constants.MODULE_TYPE.IM, "getLinker",
      [IMConstants.linkerType.one2one, this._getUserData().msguser_id,
        UserManagerChatLinker, {talkerData:this._getUserData(),
        linkerType:IMConstants.linkerType.one2one}]);
    this._linker.init({sendMessageCall:this._sendMessageCall.bind(this),
      updateCall:this._onLinkerUpdateCall.bind(this)});
  }

  _dealRenderItem(data, index) {
    return <UserManagerChatItemView data={data} selfData={this._getUserData().userData}
      userData={this._getUserData()} index={index}
      ref={(ref) => this._itemViewRefs[index] = ref}/>
  }

  _getTitle() {
    return this._getUserData().name;
  }
}
